﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using Command.HelpClass;
using czc;
using Guestbook.Biz;
using Guestbook.IBiz;
using Microsoft.Practices.Unity;
using Moon.Orm;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace WebApp.Controllers
{
    public class ButtonController : Controller
    {
       // [Dependency("Guestbook.Biz.ControlButtonsBiz")]
        public IControlButtonsBiz ControlButtonsBiz = new ControlButtonsBiz();
        //
        // GET: /Button/

        public ActionResult Index()
        {
            
            return View();
        }
        [HttpPost]
        public JsonResult GetButtonControler(string pageIndex, string pageSize)
        {

            //int pageIndex = Convert.ToInt32(Request["pageIndex"]);
            //int pageSize = Convert.ToInt32(Request["pageSize"]);
            ////字段排序
            //String sortField = Request["sortField"];
            //String sortOrder = Request["sortOrder"];
            PageClass pc = new PageClass();
            pc.sys_Fields = "*";
            pc.sys_Key = "ControlId";
            pc.sys_PageIndex = Int32.Parse(pageIndex) + 1;
            pc.sys_PageSize = Int32.Parse(pageSize);
            pc.sys_Table = "ControlButtons";
            pc.sys_Where = "1=1";
            pc.sys_Order = "ControlId";
          

            List<ControlButtons> list2 = ControlButtonsBiz.GetPagingData<ControlButtons>(pc);
            Dictionary<string, object> dic = new Dictionary<string, object>();
            ControlButtons d = new ControlButtons();

           // var mql = ControlButtonsSet.ControlId.NotEqual("");
            dic.Add("data", list2);
            dic.Add("total", pc.RCount);

            return Json(dic, JsonRequestBehavior.AllowGet); ;
        }

    }
}
